package com.xpert.action.board;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.xpert.action.CommandAction;
import com.xpert.beans.Board;
import com.xpert.dao.BoardDao;

public class ModifyProcAction implements CommandAction {

    @Override
    public String requestProc(HttpServletRequest request,
	    HttpServletResponse response) throws Throwable {
	
    	int idx = Integer.parseInt(request.getParameter("idx"));
    	String content = request.getParameter("content");
    
    	Board board = new Board();
    	board.setIdx(idx);
    	board.setContent(content);
    
    	BoardDao.getInstance().modifyArticleProc(board);

    	String page = request.getParameter("page");
    	request.setAttribute("url", "view.do?idx=" + idx + "&page=" + page);
    
    	return "redirect.jsp";
    }

}
